#include <iostream>
#include <unordered_set>

using namespace std;

int sheru(double num) {
    return int(num + 0.5);
}

int main() {
    double a, b, c, d;
    cin >> a >> b >> c >> d;

    unordered_set<int> s;
    s.insert(sheru(a + b + c + d));
    s.insert(sheru(a + b + c - d));
    s.insert(sheru(a + b + c * d));
    s.insert(sheru(a + b + c / d));
    s.insert(sheru(a + b - c + d));
    s.insert(sheru(a + b - c - d));
    s.insert(sheru(a + b - c * d));
    s.insert(sheru(a + b - c / d));
    s.insert(sheru(a + b * c + d));
    s.insert(sheru(a + b * c - d));
    s.insert(sheru(a + b * c * d));
    s.insert(sheru(a + b * c / d));
    s.insert(sheru(a + b / c + d));
    s.insert(sheru(a + b / c - d));
    s.insert(sheru(a + b / c * d));
    s.insert(sheru(a + b / c / d));

    cout << s.size() << endl;
}